<template>
  <div :class="['btnstyle',isSumbit?'':'btnFalse']" @click="clicks">
    <div v-if="loading" class="loading" />
    {{message}}
  </div>
</template>
 
 <script>
export default {
  props: {
    message: String,
    isSumbit: {
      type: Boolean,
      default: false
    },
    loading: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    //   isSumbit?$emit('btnClick'):''
    clicks() {
      if (this.loading) {
        return
      }
      if (this.isSumbit) {
        this.$emit("btnClick");
      } 

      // this.$emit('btnClick')
    }
  }


};
</script>
 
 
 <style scoped lang="less">
.loading {
  width: 0.4rem;
  height: 0.4rem;
  display: inline-block;
  vertical-align: middle;
  color: #333;
  background: url("~@/static/images/loading-btn.png");
  -webkit-animation: rotateing 1s steps(12, end) infinite;
  animation: rotateing 1s steps(12, end) infinite;
  background-size: 100%;
}
@keyframes rotateing {
  0% {
    -webkit-transform: rotate3d(0, 0, 1, 0deg);
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    -webkit-transform: rotate3d(0, 0, 1, 360deg);
    transform: rotate3d(0, 0, 1, 360deg);
  }
}

.btnstyle {
  width: 100%;
  height: 0.88rem;
  text-align: center;
  line-height: 0.88rem;
  background: @mainColor;
  font-size: 0.3rem;
  font-family: PingFangSC;
  font-weight: 600;
  color: rgba(255, 255, 255, 1);
  border-radius: 0.44rem;
}
.btnFalse {
  opacity: 0.3;
}
</style>
 